package com.edu.exam.enums.assessment;

/**
 * 推荐状态枚举
 */
public enum RecommendationStatus {
    PENDING("PENDING", "待处理"),
    APPROVED("APPROVED", "已采纳"),
    REJECTED("REJECTED", "已拒绝"),
    IGNORED("IGNORED", "已忽略");

    private final String code;
    private final String description;

    RecommendationStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
    /**
     * 从代码创建枚举实例
     *
     * @param code 枚举代码
     * @return 对应的枚举实例
     * @throws IllegalArgumentException 如果代码无效
     */
    public static RecommendationStatus fromCode(String code) {
        for (RecommendationStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown RecommendationStatus code: " + code);
    }

    /**
     * 从描述创建枚举实例
     *
     * @param description 枚举描述
     * @return 对应的枚举实例
     * @throws IllegalArgumentException 如果描述无效
     */
    @Override
    public String toString() {
        return description;
    }
}